<template>
  <div id="play">
    <div class="container">
      <div class="textlink">位置：
        <span class="navto">首页</span>&gt; <span class="navto">国产</span>&gt;
        <span class="navto">开放青年</span>» <span>高颜值黑色外套大奶妹子加钟第二炮，近距离特写口交翘起屁股摸逼后入猛操</span>
      </div>

      <div id="dplayer"></div>
<!--      <video :src="video"></video>-->

      <div class="copy">
        <em>https://</em>www.mnp456.com/html/202210/56268.html <em>(点击复制)分享给好友！</em>
      </div>
      <div class="help">播放失败，缓慢，请点击下方线路进行切换</div>

      <div class="play-group">
        <div class="item">线路一</div>
        <div class="item">线路二</div>
        <div class="item">线路三</div>
        <br>
      </div>

      <div class="pannel">
        <p>下载方式：<span>下载教程</span></p>
        <p></p>
        <div class="download">
          <input class="copyInput" style="width: 30%" readonly v-model="http" />
          <div class="btn">HTTP下载</div> <div class="btn">复制链接</div>
        </div>
        <div class="download">
          <input class="copyInput" style="width: 50%"  readonly v-model="http" />
          <div class="btn">迅雷下载</div>
        </div>
      </div>

      <div class="pannel clearfix">
        <h3 class="title">名称：看到马上插m-立花瑠莉,小泉沙彩hey-176_2  </h3>
        <p class="data"><span class="text-muted">功能：</span><a>侵权删除</a></p>
        <p class="data"><span class="text-muted">时间：</span>2022-10-20</p>
        <p class="data"><span class="text-muted">分类：</span><a >高清无码</a></p>
        <p class="data"><span class="text-muted">提醒：</span><a>本站二维码</a>&nbsp;&nbsp;&nbsp;<a >TG 看片频道</a></p>
        <p class="tag"><span class="text-tag">标签：</span><a >小泉</a>&nbsp;<a>立花瑠莉</a>&nbsp;<a >hey</a></p>
      </div>


      <div class="title">猜你喜欢</div>
      <div class="row clearfix">
        <div class="video-box" v-for="item in 10">
          <div class="box">
            <img class="imgs" src="https://pppp.642p.com/images/202205/6285df56a4abea1e9312fb7e/poster2.jpg" alt="">
            <div class="tit">{{item}}红帝都嫩模『瑶瑶』巅峰新作-香港激情疯狂夜-和闺蜜双飞伺候纹身男友-无套后入轮操-</div>
          </div>
        </div>
      </div>

    </div>
  </div>

</template>

<script>

import DPlayer from 'dplayer'

export default {
  name: "play",
  data(){
    return{
      http:'https://d1.xia12345.com/video/202208/62ec8a3699f1071ee6d955be/hd.mp4',

      dp:null,
      video: '/try/demo_source/movie.mp4'

    }
  },
  mounted() {
    var that = this
    window.URL = window.URL || window.webkitURL; //用来判断电脑系统window.webkitURL和window.URL是一样的，window.URL标准定义，window.webkitURL是webkit内核的实现，一般手机上就是使用这个，还有火狐等浏览器的实现。
    var xhr = new XMLHttpRequest();  // 实现数据请求 进行http协议的通信
    var play_url = that.video; //网上的视频地址
        // **注意，大部分视频地址都有跨域问题，在服务器上应设置好跨域的问题方便前端请求使用**
    xhr.open("GET", play_url, true);  //打开一个地址，请求类型 地址 异步或同步
    xhr.responseType = "blob";  // 设置返回值 为blob对象
    xhr.onload = function (e) { //请求后要执行的函数
      if (this.status == 200) { //成功
        var blob = this.response;  // 请求成功获取的参数 赋值给 “blob”
        console.log(blob);//创建一个对象 视频只需要获取一次， 获取一次后，就需要释放这个对象。
        var video = window.URL.createObjectURL(blob);
        that.video = video
        that.LoadVideo(video)
      }
    }
    xhr.send(); //发送请求
  },
  methods:{
    LoadVideo(video){
      this.dp = new DPlayer({
        container: document.getElementById('dplayer'),
        screenshot: true,
        video: {
          url: video,
          thumbnails: 'thumbnails.jpg',
        },
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.textlink {
  background: #ffffff;
  margin-top: 10px;
  padding: 10px;
  color: #000;
  font-size: 13px;
}

.textlink span {
  padding: 0px 5px
}
.copy {
  line-height: 20px;
  cursor: pointer; margin: 5px; border-radius: 5px; padding:  10px; font-size: 12px; /* max-width: 90%; */
  background: #222; color: hsla(0,0%,100%,.8); text-transform: lowercase; overflow: hidden; word-wrap: break-word;}
.copy em{color:#ffbf00;font-size:12px;}

.help{ font-size: 14px;color: #0086cf;margin-left: 10px;}

/* play */
.play-group {text-align: left; padding: 10px 0; display: flex; border-bottom: 2px solid #ccc; overflow: hidden;}
.play-group .item {cursor: pointer; text-align: center;
  border-radius: 7px; padding: 1px; color: #fff; background: #0086cf;
  margin: 5px; width: 30%;max-width: 100px;height: 30px; line-height: 30px;
  display: inline-block; flex-direction: column; justify-content: space-between;
}
.play-group .item {color: #fff;}
.play-group .durl {color: #fff;}
.play-group .durl {cursor: pointer; text-align: center; border-radius: 7px; padding: 1px; color: #fff; background: #333;margin: 5px; min-width: 100px; display: inline-block; flex-direction: column; justify-content: space-between;
}

/* pannel */
.pannel{position: relative; margin-bottom: 20px;background: #ffffff;margin-top: 10px; padding: 15px;line-height: 25px;border-radius: 7px;}
.pannel p {font-size: 14px;color: #333;margin: 0px; padding: 5px 0}
.pannel span{ color: #0086cf;font-size: 14px;}
.pannel p.tag a {color: #0086cf;border: #0086cf solid 1px;margin: 5px;padding: 5px;font-size: 14px;}
.pannel p.tag a:hover{color: #0086cf;border: #0086cf solid 1px;margin: 5px;padding: 5px;font-size: 14px;}

.download{margin-top: 20px}
.download .btn{ display: inline-block;   background-color: #333;font-size: 14px;
  color: #fff; margin-left:10px; padding:0px 10px;border-radius: 5px; line-height: 38px; }
.download .copyInput{ padding:0px 10px;border-radius: 5px; line-height: 38px; outline-style: none;
  border: 1px solid #ddd;
  border-radius: 3px; }





.title{width: 100%; color: #FFF;
  height: 40px; line-height: 40px; padding: 0px 15px; box-sizing: border-box;
  margin: 10px 0; border-bottom: 1px solid #aaa;
  background-color: #0086cf;

  .total{color: #333;float:right;line-height:40px;font-size:14px;text-align:right;margin-right: 10px;}
  .total em{padding:0 5px;color:#ffbf00;font-weight:bold; font-style: normal; font-size: 16px;}

}
//自定义栅格 大-lg 中-md 小-sm
.row{ margin: 0px -5px;}
.row > div{padding: 5px; box-sizing: border-box; float: left; }
.row .video-box{width: 20%;}

@media screen and (max-width:1280px){
  .row .video-box{width: 33.3%;}
  .row .video-box:nth-child(9){display: none}
}
@media screen and (max-width:760px){
  .row .video-box{width: 50%;}
  .row .video-box:nth-child(9){display: block}
}

.box{
  cursor: pointer;
  .imgs{width: 100%}
  .tit{
    text-align: center; line-height:30px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }
}
.box:hover{background: #ccc}
</style>
